/**

 * User: seeker910
 * Date: 13-11-8
 * Time: 上午1:38

 */
Rsd.define('Rsd.form.Number', {
    extend: 'Rsd.form.Input',
    xtype: 'number',
//    height: 30,
//    width: 80,
    text: '',
    inputType: 'number',
    ctrlCls: 'x-control-number',
    handler: null,
    precision:0,
    min:null,
    max:null,
    /**
     * 
     */
    constructor: function Number(config) {
        config = config || {};
        this.apply(config); 
    },
    /**
     * 
     */
    onAfterInit: function onAfterInit() {
        this.callParent();
        var me = this;
        if(me.min != undefined && me.min != null)
        {
            me.ctrl.element.setAttribute("min",this.min);
        }
        if(me.max != undefined && me.max != null)
        {
            me.ctrl.element.setAttribute("max",this.max);
        }
    },
    /**
     * 
     * @param {*} value 
     */
    setValue:function setValue(value) {
        var _v = parseFloat(value).toFixed(this.precision||0);
         this.callParent(_v);
    },
    /**
     * 
     * @returns 
     */
    getValue:function getValue()
    {
        var me = this;
        var _v = me.callParent();
        return Rsd.isEmpty(_v)?0: Number(_v);
    }

});

